class Solution {
public:
    vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {
        // 定义差分数组
        vector<int> vt(n + 1, 0);

        // 将区间增量叠加到差分数组
        for(int idxRow = 0; idxRow < bookings.size(); idxRow++) {
            vt[bookings[idxRow][0] - 1] += bookings[idxRow][2];
            vt[bookings[idxRow][1]] -= bookings[idxRow][2];
        }

        // 对差分数组求前缀和，得到原数组
        for (int idx = 1; idx < n; idx++) {
            vt[idx] +=  vt[idx - 1];
        }
        vt.pop_back();
        return vt;
    }
};